#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>

#include "sans.h"
#include "garbagecollector.h"
#include "runtime.h"

sdata bltn_eq_question(sdata x, sdata y) {
  if (x.tag != y.tag) {
    return SDBOOL(0);
  }
  
  switch (x.tag) {
  case tsymb:
  case tcons:
  case tvect:
  case tstrn:
  case tclos:
  case tlabl:
    return SDBOOL(x.data.value == y.data.value);
  case tnumb:
  case tchar:
  case tbool:
    return SDBOOL(x.data.ivalue == y.data.ivalue);
  case teof:
  case tnull:
    return SDBOOL(1);
  }

  log_err("runtime_eq/bltn_eq: reached impossible location\n");
  exit(-1);
}
